package gui.batches.command;

import hit.core.HomeInventoryTracker;
import hit.core.Item;

import java.util.List;

/**
 * A Command that handles undo/redo of removing Items from the ItemFacade
 * */
public class RemoveItemsCommand extends Command {
	private List<Item> itemsToRemove;
	
	/**
	 * Initializes the RemoveItemsCommand with a List of Items to remove
	 * @param itemsToRemove the Items to remove
	 * */
	public RemoveItemsCommand(List<Item> itemsToRemove) {
		this.itemsToRemove = itemsToRemove;
	}
	
	/**
	 * Remove the Items
	 * @return the List of removed Items affected by the command
	 * */
	@Override
	public List<Item> Execute() {
		HomeInventoryTracker.Instance().GetItemFacade().RemoveItems(itemsToRemove);
		return itemsToRemove;
	}
	
	/**
	 * Return the Items to the original ProductContainers
	 * @return the List of Items affected by the undo
	 * */
	@Override
	public List<Item> Undo() {
		HomeInventoryTracker.Instance().GetItemFacade().UndoRemoveItems(itemsToRemove);
		return itemsToRemove;
	}

}
